<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<%@ page import="com.bci.pwtz.service.impl.CompanyServiceImpl"%>
<%@ page import="java.util.List"%>
<%@ page import="com.bci.pwtz.mysql.model.Company"%>
<%@ page import="org.apache.commons.lang3.StringUtils"%>
<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>

<%@ page import="com.bci.pwtz.mysql.model.CompanyUser"%>
<%@ page import="com.bci.pwtz.service.CompanyService"%>

<%@ include file="../common.jsp" %>
<%
CompanyUser companyUser = (CompanyUser) session.getAttribute("user");
if(companyUser==null)
{ 
    response.sendRedirect(basePath+"user/login.jsp");
    return;
}
CompanyService companyService = (CompanyService)SpringUtil.getBean("companyService");
List<Company> companyList = companyService.findCompanyByUserId(companyUser.getCompanyUserId());
if(companyList != null && companyList.size() > 0)
{
    if(companyUser.getLastCompanyId()!=null && companyUser.getLastCompanyId()>0)
    {
        response.sendRedirect(basePath+"user/m/index.jsp");
        /* response.setContentType("text/html; charset=gb2312");
        ServletContext sc = request.getServletContext();
        RequestDispatcher rd = null;     
       	rd = sc.getRequestDispatcher("index.jsp"); //定向的页面
       	rd.forward(request, response); */
        return;
    }
    else
    {
    	response.sendRedirect(basePath+"user/m/switch.jsp");
    	return;
    }
}
%>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>配网数据-单位选择</title>
<link href="../css/llcss.css" rel="stylesheet" type="text/css" />
<script type="text/javascript" src="../../js/jquery/jquery-1.8.0.min.js"></script>
<script src="../js/hd_ll.js" type="text/javascript"></script>
<link href="../css/style.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div class="zcsuc_body_bg">
	<div class="regsuc_box">
		<!-- 标题_begin -->
		<div class="regsuc_box_title">
			<h2 class="zcsuc">选择单位</h2>
			<h2 class="logout" style="float:right;"><a  onclick="logout();return false;" class="esc" style="font-size: 22px; margin-right:10px">[ 退出登录 ]</a></h2>
		</div>
		<!-- 标题_end -->
		<!-- 内容_begin -->
		<div class="regsuc_box_cont">
			<p class="p2" style="margin-left:50px;">你还没有加入任何单位，请先加入单位，如未找到你所属单位，请创建单位</p>		
			<a class="a3" href="createcompany.jsp">创建单位</a>
			<a class="a2" style="margin-left:150px;" href="joincompany.jsp">加入单位</a>
		</div>
		<!-- 内容_end -->
	</div>
</div>
   <%@ include file="../foot.jsp"%>
</body>
<script>
function logout()
{
		if(confirm('你是否退出该系统?'))
			{
			location.href=contextPath+"user/companyuser/logout?loginUrl="+escape(contextPath+'user/login.jsp');
			}
}
</script>   
</html>